package com.ipncinf.camera;

import java.util.regex.Pattern;

public class PatternUtils {

	public static final String ip = "^((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]|[*])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]|[*])$";
	public static final String nonNegativeInteger = "^\\d+$"; // 非负整数
	public static final String positiveInteger = "^[0-9]*[1-9][0-9]*$"; // 正整数
	public static final String integer = "^-?\\d+$"; // 整数

	public static boolean doPattern(String field, String patternReg) {
		return Pattern.compile(patternReg).matcher(field).matches();
	}

	public static void main(String[] args) {
		System.out.println(doPattern("0", nonNegativeInteger));
	}

}
